﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PI_CS_Library;

namespace PI_CS_GUI
{
    public partial class ParametersGUI : Form
    {
        RoutingController _rc;

        public ParametersGUI(RoutingController _rc, GUIDelegate _gui)
        {
            InitializeComponent();
            this._rc = _rc;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (!checkBox1.Checked)
            {
                textBox1.Enabled = true;
                textBox2.Enabled = true;
                domainUpDown1.Enabled = true;
            }
            else
            {
                textBox1.Enabled = false;
                textBox2.Enabled = false;
                domainUpDown1.Enabled = false;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (!checkBox1.Checked)
            {
                _rc.LinkDelayRef = Int32.Parse(textBox1.Text);
                _rc.MatrixDelayRef = Int32.Parse(textBox2.Text);
                _rc.LinkErrorRateRef = float.Parse(domainUpDown1.Text);
                _rc.AvgReference = false;

            }

            this.Close();
        }

        private void domainUpDown1_SelectedItemChanged(object sender, EventArgs e)
        {

        }
    }
}
